<?php
namespace app\admin\controller;
use \think\Controller;
use \think\Session;
use \think\Db;
class Newscomment extends Common
{
	public function index(){

		if(input('commentid')==''&&input('newsid')=='')
			$result = Db::name('newscomment')->alias('a')->join('news b','a.news_id=b.news_id')->join('user c','a.user_id = c.user_id')->order('a.news_id')->select();	
		else if(input('newsid')=='')
			$result = Db::name('newscomment')->where('comment_id',input('commentid'))->alias('a')->join('news b','a.news_id=b.news_id')->join('user c','a.user_id = c.user_id')->order('a.news_id')->select();	
		else
			$result = Db::name('newscomment')->where('a.news_id',input('newsid'))->alias('a')->join('news b','a.news_id=b.news_id')->join('user c','a.user_id = c.user_id')->order('a.news_id')->select();	
		$this->assign('commentlist',$result);
		return $this->fetch();

	
	}

	
}